package com.zyw.module.console.dict.service;

import com.zyw.module.console.dict.dao.DictDao;
import com.zyw.module.console.dict.po.Dict;
import com.zyw.mvc.support.BaseService;
import com.zyw.orm.support.page.Page;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DictService extends BaseService<Dict, Integer, DictDao> {

    public Dict get(Integer id) {
        return getDao().selectByPrimaryKey(id);
    }

    @Transactional
    public int insert(Dict record) {
        return getDao().insert(record);
    }

    @Transactional
    public int update(Dict record) {
        return getDao().updateByPrimaryKey(record);
    }

    @Transactional
    public int delete(Integer id) {
        return getDao().deleteByPrimaryKey(id);
    }

    public List<Dict> findByPage(Page<Dict> page) {
        List<Dict> list = getDao().findByPage(page);
        page.setList(list);
        return list;
    }
}